<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta charset="utf-8">
    <meta name="applicable-device" content="pc,mobile">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="/favicon.ico" type="image/x-icon">
    {% module use_f2e('f2elib') %}
    {% module use_f2e('codemirror') %}

    {% block headinfo %}
    {% end %}
    {% block head %}
    {% end %}



    <link href="/static/css/lib/font-awesome/css/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="/static/tass/css/style.css" type="text/css">
</head>
<body>


<nav class="mb-4 navbar navbar-expand-lg navbar-light bg-light fixed-top">
    <div class="container-fluid">
        <a class="navbar-brand" href="/">GISLite</a>
        <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNavDropdown"
                aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
        </button>
        <div class="collapse navbar-collapse" id="navbarNavDropdown">
            <ul class="navbar-nav">

                {% module widget_menu() %}

                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" role="button"
                       data-bs-toggle="dropdown" aria-expanded="false">
                        {{ _('User') }}
                    </a>
                    <ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">

                        <li><a class="dropdown-item" href="/user_list/user_recent">{{ _('Recent use') }}</a></li>
                        <li><a class="dropdown-item" href="/user_list/user_most">{{ _('Most use') }}</a></li>
                        <li class="divider"></li>
                        <li><a class="dropdown-item" href="/collect/list">{{ _('My collection') }}</a></li>
                        <li class="divider"></li>
                        <li><a class="dropdown-item" href="/user/info">{{ _('Personal Data') }}</a></li>


                    </ul>
                </li>
            </ul>
        </div>
        <div class="d-flex">

            <div class="collapse navbar-collapse">
                <ul class="navbar-nav">
                    {% if userinfo %}
                    <li class="nav-item">
                        <a class="nav-link " aria-current="page" href="/user/info">
                            {{ userinfo.user_name }}
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link " aria-current="page" href="/user/logout">
                            {{ _('Logout') }}
                        </a>
                    </li>
                    {% else %}
                    <li class="nav-item">
                        <a class="nav-link " aria-current="page" href="/user/login">
                            {{ _('Login') }}
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="nav-link " aria-current="page" href="/user/regist">
                            {{ _('Register') }}
                        </a>
                    </li>
                    {% end %}
                </ul>
            </div>
            {% module widget_search() %}
        </div>
    </div>
</nav>


{% block mainbody %}
<div class="container" style="">
    {#<div class="container" style="padding-top: 80px">#}
    {% block typebody %}{% end %}
</div>

{% end %}


<div id="copyrights">
    <div class="container">
        <p>
            Powered by TorCMS (<a href="https://github.com/bukun/TorCMS">https://github.com/bukun/TorCMS</a>).
        </p>
    </div>
</div>
<script type="text/javascript">
  var urlstr = location.href;

    // 先全局清理所有激活状态[7](@ref)
    $('.nav-item, .dropdown').removeClass('active');

    // 同时处理普通导航项和下拉菜单项
    $(".nav-link, .dropdown-item").each(function () {
        const $this = $(this);
        const linkHref = new URL($this.attr('href'), location.origin).pathname;
        const currentPath = new URL(urlstr).pathname;

        // 增强路径匹配（支持子路径）[7](@ref)
        if (currentPath.startsWith(linkHref) && linkHref !== '/') {
            // 激活当前项
            $this.addClass('active');

            // 修正父级定位逻辑（关键）
            const $dropdownParent = $this.closest('.dropdown-menu').closest('.dropdown');
            if ($dropdownParent.length) {
                // 同时激活父级菜单按钮和容器
                $dropdownParent.addClass('active');
                $dropdownParent.find('.dropdown-toggle').addClass('active');
            }


        }
    });
</script>
<script src="/static/css/lib/jquery/jquery.min.js"></script>
<script src="/static/css/lib/hover-pack/hover-pack.js"></script>
<script src="/static/js/main.js"></script>
<script type="text/javascript"
        src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="{{ static_url('jslib/dst/gscript.js') }}"></script>
<script type="text/javascript" src="{{ static_url('jslib/dst/referrer.js') }}"></script>
</body>
</html>



